home *** CD-ROM | disk | FTP | other *** search
/ Star Trek Starfleet Academy Mini Omnipedia / MINI_OMNI.ISO / pc / omni_v2.dxr / 00393_Interface Hlt Script.ls < prev    next >
Encoding:
Text File  |  1996-04-15  |  11.9 KB  |  358 lines

  1. property iHltsprite, iHowManyButton, iCastHeight, iCastWidth, iEachButtonWidth, iHltpixel, iEachButtonHeight, iFullCast, iSearchPopOut, iHeader, IEachButtonHeightModes
  2. global gHltPixel, gFlashPixel, gModeHighltSprite, gSearchPopOut, gHeaderHere, gHoldSearchInfo, gFindBase, gColorMac, gComputerTypeK, gExtraSpeed, gDefaultENTRYstate, gDefaultENCstate, gHoldEncPixelSprite, gHoldEntPixelSprite, gSearchButton, gDefaultSearchstate, gInputFieldSpr, gDefaultTextstate, gDefaultPixelstate, vENTRYpushBaseCast, gHoldENCstate, gBlankBar, gBtnHitSND, gFindSND, gTopicBase
  3.  
  4. on birth me, pWhichSprite, pHowMany, pcastMem
  5.   set iHltsprite to pWhichSprite
  6.   set iHowManyButton to pHowMany + 0.0
  7.   set iCastHeight to the height of cast pcastMem
  8.   set iCastWidth to the width of cast pcastMem
  9.   set iEachButtonHeight to iCastHeight / iHowManyButton
  10.   set iEachButtonWidth to iCastWidth / iHowManyButton
  11.   set iFullCast to pcastMem
  12.   set IEachButtonHeightModes to iCastHeight / (iHowManyButton / 2)
  13.   set iHltpixel to gHltPixel
  14.   set iSearchPopOut to gSearchPopOut
  15.   set iHeader to gHeaderHere
  16.   return me
  17. end
  18.  
  19. on mDumpParams me
  20. end
  21.  
  22. on mHltVer me, pCheckSpeech
  23.   global gSpeechCapable
  24.   puppetSprite(iHltsprite, 1)
  25.   set vMousePos to getAt(the clickLoc, 2)
  26.   set vRelativeClick to vMousePos - the top of sprite iHltsprite
  27.   set vWhere to integer((vRelativeClick / iEachButtonHeight) + 0.4999999)
  28.   if vWhere < 1 then
  29.     set vWhere to 1
  30.   end if
  31.   set whereHor to the left of sprite iHltsprite
  32.   set whereVer to the top of sprite iHltsprite + ((vWhere - 1) * iEachButtonHeight)
  33.   set vwhom to iFullCast + vWhere
  34.   if pCheckSpeech = 1 then
  35.     if (gSpeechCapable = 0) and (vWhere = 3) then
  36.       return 0
  37.     end if
  38.   end if
  39.   mSwitchCast(me, whereHor, whereVer, vwhom)
  40.   puppetSprite(iHltsprite, 0)
  41.   return vWhere
  42. end
  43.  
  44. on mHltVerWithOption me, pCheckSpeech
  45.   global gSpeechCapable
  46.   puppetSprite(iHltsprite, 1)
  47.   if inside(point(the mouseH, the mouseV), the rect of sprite iHltsprite) then
  48.     set vMousePos to the mouseV
  49.   end if
  50.   set vRelativeClick to vMousePos - the top of sprite iHltsprite
  51.   set vWhere to integer((vRelativeClick / iEachButtonHeight) + 0.4999999)
  52.   if vWhere < 1 then
  53.     set vWhere to 1
  54.   end if
  55.   set whereHor to the left of sprite iHltsprite
  56.   set whereVer to the top of sprite iHltsprite + ((vWhere - 1) * iEachButtonHeight)
  57.   set vwhom to iFullCast + vWhere
  58.   mSwitchCastOptions(me, whereHor, whereVer, vwhom)
  59.   return vWhere
  60. end
  61.  
  62. on mHltTopVer me
  63.   set vMousePos to getAt(the clickLoc, 2)
  64.   set vRelativeClick to vMousePos - the top of sprite iHltsprite
  65.   set vWhere to integer((vRelativeClick / iEachButtonHeight) + 0.4999999)
  66.   if vWhere < 1 then
  67.     set vWhere to 1
  68.   end if
  69.   if vWhere = 2 then
  70.     set vWhere to 1
  71.   end if
  72.   set whereHor to the left of sprite iHltsprite
  73.   set whereVer to the top of sprite iHltsprite + ((vWhere - 1) * iEachButtonHeight)
  74.   set vwhom to iFullCast + vWhere
  75.   hearit(gBtnHitSND)
  76.   mSwitchHold(me, whereHor, whereVer, vwhom, gHltPixel)
  77.   if vWhere = 3 then
  78.     set the locH of sprite gHltPixel to -100
  79.     updateStage()
  80.   end if
  81.   return vWhere
  82. end
  83.  
  84. on mForceTopHlt me, pVal
  85.   set whereHor to the left of sprite gTopicBase
  86.   set whereVer to the top of sprite gTopicBase + ((pVal - 1) * iEachButtonHeight)
  87.   set vwhom to iFullCast + pVal
  88.   hearit(gBtnHitSND)
  89.   mSwitchHold(me, whereHor, whereVer, vwhom, gHltPixel)
  90.   if pVal = 3 then
  91.     set the locH of sprite gHltPixel to -100
  92.     updateStage()
  93.   end if
  94. end
  95.  
  96. on mPopSearchStrip me
  97.   if gHoldSearchInfo = 0 then
  98.     mOut(me)
  99.   else
  100.     min(me)
  101.   end if
  102. end
  103.  
  104. on mOut me
  105.   set vWidthHeader to the right of sprite iHeader - the left of sprite iHeader
  106.   mPopOut(me, iHeader, the right of sprite iHeader, 645 + vWidthHeader, 4 + (gExtraSpeed / 2))
  107.   mPopOut(me, iSearchPopOut, 0, 636, 15 + gExtraSpeed)
  108.   mMoveSearchStuff(me)
  109.   set gHoldSearchInfo to 1
  110. end
  111.  
  112. on min me
  113.   mLoseSearchStuff(me)
  114.   mPopIn(me, iSearchPopOut, the right of sprite iSearchPopOut, -2, -15 - gExtraSpeed)
  115.   mPopIn(me, iHeader, the left of sprite iHeader, 632, -4 - (gExtraSpeed / 2))
  116.   set gHoldSearchInfo to 0
  117. end
  118.  
  119. on mMoveSearchStuff me
  120.   mSwitchHold(me, 464, 26, gDefaultENTRYstate, gHoldEntPixelSprite)
  121.   mSwitchHold(me, 579, 26, gDefaultENCstate, gHoldEncPixelSprite)
  122.   mSwitchHold(me, 377, 26, gDefaultSearchstate, gSearchButton)
  123.   mSwitchHold(me, 89, 19, gDefaultTextstate, gInputFieldSpr)
  124.   set the editableText of sprite gInputFieldSpr to 1
  125. end
  126.  
  127. on mLoseSearchStuff me
  128.   mSwitchHold(me, 464, 470, gDefaultENTRYstate, gHoldEntPixelSprite)
  129.   mSwitchHold(me, 579, 470, gDefaultENCstate, gHoldEncPixelSprite)
  130.   mSwitchHold(me, 377, 470, gDefaultSearchstate, gSearchButton)
  131.   mSwitchHold(me, 77, 470, gDefaultPixelstate, gInputFieldSpr)
  132.   set the editableText of sprite gInputFieldSpr to 0
  133. end
  134.  
  135. on mHltModes me
  136.   puppetSprite(iHltsprite, 1)
  137.   hputmsg(">mHltModes> iHltsprite" && iHltsprite)
  138.   set vMousePos to getAt(the clickLoc, 2)
  139.   set vMouseVer to getAt(the clickLoc, 1)
  140.   set vRelativeClick to vMousePos - the top of sprite iHltsprite
  141.   set vRelClickCheck to vMouseVer - the left of sprite iHltsprite
  142.   set vWhere to integer((vRelativeClick / IEachButtonHeightModes) + 0.4999999)
  143.   if vWhere < 1 then
  144.     set vWhere to 1
  145.   end if
  146.   set whereHor to the left of sprite iHltsprite
  147.   set whereVer to the top of sprite iHltsprite + ((vWhere - 1) * IEachButtonHeightModes)
  148.   set vwhom to iFullCast + vWhere
  149.   set vCenter to iCastWidth / 2
  150.   if vRelClickCheck > vCenter then
  151.     set vWhere to vWhere + 3
  152.     set whereHor to the left of sprite iHltsprite + vCenter
  153.     set whereVer to the top of sprite iHltsprite + ((vWhere - 1) * IEachButtonHeightModes) - iCastHeight
  154.     set vwhom to iFullCast + vWhere
  155.   end if
  156.   hputmsg(">mHltModes> vWhere=" & vWhere & "    vWhom=" & vwhom)
  157.   mSwitchHold(me, whereHor, whereVer, vwhom, gModeHighltSprite)
  158.   hputmsg("mHltModes> gModeHighltSprite" && gModeHighltSprite)
  159.   return vWhere
  160. end
  161.  
  162. on mSwitchCast me, whereHor, whereVer, vwhom
  163.   puppetSprite(gFlashPixel, 1)
  164.   set the locH of sprite gFlashPixel to whereHor
  165.   set the locV of sprite gFlashPixel to whereVer
  166.   set the castNum of sprite gFlashPixel to vwhom
  167.   updateStage()
  168.   hearit(gBtnHitSND)
  169.   repeat while the stillDown
  170.     nothing()
  171.   end repeat
  172.   puppetSprite(gFlashPixel, 0)
  173. end
  174.  
  175. on mSwitchCastOptions me, whereHor, whereVer, vwhom
  176.   puppetSprite(gFlashPixel, 1)
  177.   set the locH of sprite gFlashPixel to whereHor
  178.   set the locV of sprite gFlashPixel to whereVer
  179.   set the castNum of sprite gFlashPixel to vwhom
  180.   updateStage()
  181.   hearit(gBtnHitSND)
  182.   puppetSprite(gFlashPixel, 0)
  183. end
  184.  
  185. on mPopOut me, whichsprite, vstartHere, vendHere, vDivide
  186.   puppetSprite(whichsprite, 1)
  187.   hearit(gFindSND)
  188.   repeat with vstartHere = vstartHere to vendHere
  189.     set the locH of sprite whichsprite to vstartHere
  190.     set the locV of sprite whichsprite to 15
  191.     set vstartHere to vstartHere + vDivide
  192.     updateStage()
  193.   end repeat
  194.   set the locH of sprite whichsprite to vendHere
  195.   set the locV of sprite whichsprite to 15
  196.   updateStage()
  197. end
  198.  
  199. on mPopIn me, whichsprite, vstartHere, vendHere, vDivide
  200.   puppetSprite(whichsprite, 1)
  201.   hearit(gFindSND)
  202.   repeat with vstartHere = vstartHere down to vendHere
  203.     set the locH of sprite whichsprite to vstartHere
  204.     set the locV of sprite whichsprite to 15
  205.     set vstartHere to vstartHere + vDivide
  206.     updateStage()
  207.   end repeat
  208.   set the locH of sprite whichsprite to vendHere
  209.   set the locV of sprite whichsprite to 15
  210.   updateStage()
  211. end
  212.  
  213. on mLeaveMode me
  214.   puppetSprite(iHltpixel, 0)
  215.   puppetSprite(iHltsprite, 0)
  216.   puppetSprite(iHeader, 0)
  217.   updateStage()
  218. end
  219.  
  220. on mCheckHeader me
  221.   if gHoldSearchInfo = 1 then
  222.     puppetSprite(iHeader, 1)
  223.     set vWidthHeader to the right of sprite iHeader - the left of sprite iHeader
  224.     set whom to the castNum of sprite iHeader
  225.     mSwitchHold(me, 645 + vWidthHeader, the top of sprite iHeader, whom, iHeader)
  226.   else
  227.     puppetSprite(iHeader, 1)
  228.     set vWidthHeader to the right of sprite iHeader - the left of sprite iHeader
  229.     set whom to the castNum of sprite iHeader
  230.     mSwitchHold(me, 633, 15, whom, iHeader)
  231.   end if
  232. end
  233.  
  234. on mPushDown me, vHLoc, vendHere, vDivide
  235.   puppetSprite(iHltsprite, 1)
  236.   set the locH of sprite iHltsprite to vHLoc
  237.   repeat with vstartHere = 0 to vendHere
  238.     set the locV of sprite iHltsprite to vstartHere
  239.     set vstartHere to vstartHere + vDivide
  240.     updateStage()
  241.   end repeat
  242.   set the locV of sprite iHltsprite to vendHere
  243.   updateStage()
  244.   mRollOver(me)
  245. end
  246.  
  247. on mRollOver me
  248.   repeat while the stillDown
  249.     if the mouseCast = iFullCast then
  250.       set vMousePos to the mouseV
  251.       set vRelativeClick to vMousePos - the top of sprite iHltsprite
  252.       set vWhere to integer((vRelativeClick / (iEachButtonHeight + 0.0)) + 0.4999999)
  253.       if vWhere < 1 then
  254.         set vWhere to 1
  255.       end if
  256.       set whereHor to the left of sprite iHltsprite
  257.       set whereVer to the top of sprite iHltsprite + ((vWhere - 1) * iEachButtonHeight)
  258.       set vwhom to iFullCast + vWhere
  259.       mSwitchCastHlt(me, whereHor, whereVer, vwhom)
  260.       next repeat
  261.     end if
  262.   end repeat
  263.   puppetSprite(iHltsprite, 0)
  264.   if (the mouseCast > iFullCast) and (the mouseCast <= (iFullCast + iHowManyButton)) then
  265.     if vENTRYpushBaseCast = iFullCast then
  266.       set gDefaultENTRYstate to iFullCast + vWhere + iHowManyButton
  267.     else
  268.       set gDefaultENCstate to iFullCast + vWhere + iHowManyButton
  269.       if gDefaultENCstate <> gBlankBar then
  270.         set gHoldENCstate to gDefaultENCstate
  271.       end if
  272.     end if
  273.     hSwitchScopeStuff(iHltsprite, vWhere)
  274.     hearit(gBtnHitSND)
  275.     updateStage()
  276.     return vWhere
  277.   end if
  278. end
  279.  
  280. on mSwitchCastHlt me, whereHor, whereVer, vwhom
  281.   puppetSprite(gFlashPixel, 1)
  282.   set the locH of sprite gFlashPixel to whereHor
  283.   set the locV of sprite gFlashPixel to whereVer
  284.   set the castNum of sprite gFlashPixel to vwhom
  285.   updateStage()
  286.   puppetSprite(gFlashPixel, 0)
  287. end
  288.  
  289. on mRollOverHorizontal me
  290.   if the mouseCast = iFullCast then
  291.     set vMousePos to the mouseH
  292.     set vRelativeClick to vMousePos - the left of sprite iHltsprite
  293.     set vWhere to integer((vRelativeClick / (iEachButtonWidth + 0.0)) + 0.4999999)
  294.     if vWhere < 1 then
  295.       set vWhere to 1
  296.     end if
  297.     set whereHor to the left of sprite iHltsprite + ((vWhere - 1) * iEachButtonWidth)
  298.     set whereVer to the top of sprite iHltsprite
  299.     set vwhom to iFullCast + vWhere
  300.     mSwitchCastHlt(me, whereHor, whereVer, vwhom)
  301.     return vWhere
  302.   else
  303.     return 
  304.   end if
  305. end
  306.  
  307. on mClearTopHlt me
  308.   set the locH of sprite gHltPixel to -100
  309.   updateStage()
  310.   puppetSprite(gHltPixel, 0)
  311. end
  312.  
  313. on mHltfromScripts me, vWhere
  314.   puppetSprite(iHltsprite, 1)
  315.   set whereVer to the top of sprite iHltsprite
  316.   set whereHor to the left of sprite iHltsprite + ((vWhere - 1) * iEachButtonWidth)
  317.   set vwhom to iFullCast + vWhere
  318.   mSwitchHold(me, whereHor, whereVer, vwhom, iHltpixel)
  319. end
  320.  
  321. on mHltfromScriptsVer me, vWhere
  322.   puppetSprite(iHltsprite, 1)
  323.   set whereHor to the left of sprite iHltsprite
  324.   set whereVer to the top of sprite iHltsprite + ((vWhere - 1) * iEachButtonHeight)
  325.   set vwhom to iFullCast + vWhere
  326.   mSwitchHold(me, whereHor, whereVer, vwhom, iHltpixel)
  327. end
  328.  
  329. on mHltfromScriptsVer2 me, vWhere
  330.   puppetSprite(iHltsprite, 1)
  331.   set whereHor to the left of sprite iHltsprite
  332.   set whereVer to the top of sprite iHltsprite + ((vWhere - 1) * iEachButtonHeight)
  333.   set vwhom to iFullCast + vWhere
  334.   mSwitchHold(me, whereHor, whereVer, vwhom, gHltPixel)
  335. end
  336.  
  337. on mHltFromScriptModes me, vWhere
  338.   puppetSprite(iHltsprite, 1)
  339.   set whereHor to the left of sprite iHltsprite
  340.   set whereVer to the top of sprite iHltsprite + ((vWhere - 1) * IEachButtonHeightModes)
  341.   set vwhom to iFullCast + vWhere
  342.   set vCenter to iCastWidth / 2
  343.   if vWhere > 3 then
  344.     set whereHor to the left of sprite iHltsprite + vCenter
  345.     set whereVer to the top of sprite iHltsprite + ((vWhere - 1) * IEachButtonHeightModes) - iCastHeight
  346.     set vwhom to iFullCast + vWhere
  347.   end if
  348.   mSwitchHold(me, whereHor, whereVer, vwhom, gModeHighltSprite)
  349. end
  350.  
  351. on mSwitchHold me, whereHor, whereVer, vwhom, whichpixel
  352.   puppetSprite(whichpixel, 1)
  353.   set the locH of sprite whichpixel to whereHor
  354.   set the locV of sprite whichpixel to whereVer
  355.   set the castNum of sprite whichpixel to vwhom
  356.   updateStage()
  357. end
  358.